package com.ddpt.platform.common.enums;

import com.ddpt.platform.common.exception.CommonException;
import com.ddpt.platform.common.exception.ErrorEnum;
import org.apache.commons.lang3.StringUtils;

/**
 * 后台服务
 */
public enum AdminService {

    /**
     * SaaS后台
     */
    BACK,
    /**
     * 商户后台
     */
    MERCHANT,
    /**
     * 商家后台
     */
    STORE;

    public static AdminService getInstance(String serviceStr) {
        if(StringUtils.isNotBlank(serviceStr)) {
            for (AdminService service : values()) {
                if(service.toString().equals(serviceStr)) {
                    return service;
                }
            }
        }
        throw new CommonException(ErrorEnum.PARAM_ERROR);
    }
}
